# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  # Pick a unique cookie name to distinguish our session data from others'
  session :session_key => '_myapp_session'
  
  helper_method :current_theme
  
  def current_theme   
    @@stored_theme = Theme.find('classicbeauty')   
  end  

  def theme_layout #用于layout :theme_layout   
    current_theme.layout   
  end   
  
  def setup_themer #设置视图文件（View) 读取路径   
    self.view_paths=::ActionController::Base.view_paths.dup.unshift("#{RAILS_ROOT}/themes/#{current_theme.name}/views")   
  end
  
  #get_configuration('theme').value 是获取存储在DataBase里面的当前Theme的名字
end
